<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="t" uri="http://www.sishuok.com/tags/easyui-tags" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html>
<head>
    <%@ include file="../../common/global.jsp" %>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <title>丰源轮胎销售管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <meta name="description" content="丰源轮胎销售管理系统">
    <link rel="shortcut icon" href="${ctx}/resources/images/logo.ico">
    <link rel="stylesheet" href="${ctx}/resources/css/index.css">
</head>

<t:base type="cloudAdmin,fontAwesome,themesDefault,jquery,responsive,bootstrap,jqueryUI,jQuery-Cookie"></t:base>
<t:base type="script,main,navigation,fullCalendar"></t:base>

<body>
<!-- HEADER -->
<header class="navbar clearfix" id="header">
    <div class="container">
        <div class="navbar-brand">
            <!-- COMPANY LOGO -->
            <a href="#" name="top">
                <img src="http://www.fytire.com/public/img/logo.jpg" alt="Cloud Admin Logo" class="img-responsive">
            </a>
            <!-- /COMPANY LOGO -->
            <!-- TEAM STATUS FOR MOBILE -->
            <div class="visible-xs">
                <a href="#" class="team-status-toggle switcher btn dropdown-toggle">
                    <i class="fa fa-users"></i>
                </a>
            </div>
            <!-- /TEAM STATUS FOR MOBILE -->
            <!-- SIDEBAR COLLAPSE -->
            <div id="sidebar-collapse" class="sidebar-collapse btn">
                <i class="fa fa-bars" data-icon1="fa fa-bars" data-icon2="fa fa-bars"></i>
            </div>
            <!-- /SIDEBAR COLLAPSE -->
        </div>

        <!-- BEGIN TOP NAVIGATION MENU -->
        <ul class="nav navbar-nav pull-right">
            <!-- BEGIN NOTIFICATION DROPDOWN -->
            <li class="dropdown" id="header-notification" title="待办事项">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                    <i class="fa fa-bell"></i>
                        <span></span>
                </a>
                <ul class="dropdown-menu notification">
                    <li class="dropdown-title">
                        <span><i class="fa fa-bell"></i>待办事项</span>
                    </li>

                    <li id="notification_footer" class="footer">
                        <a href="<%=request.getContextPath()%>/admin/dashboard/todoList" style="font-size: smaller" class="menuItem">查看所有待办 <i class="fa fa-arrow-circle-right"></i></a>
                    </li>
                </ul>
            </li>
            <!-- END NOTIFICATION DROPDOWN -->
            <!-- BEGIN INBOX DROPDOWN -->
            <li class="dropdown" id="header-message" title="未读系统消息">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                    <i class="fa fa-envelope"></i>
                        <span></span>
                </a>
                <ul class="dropdown-menu inbox">
                    <li class="dropdown-title">
                        <span><i class="fa fa-envelope-o"></i>未读系统消息</span>
                        <span class="compose pull-right tip-right" title="Compose message"><i
                                class="fa fa-pencil-square-o"></i></span>
                    </li>

                    <li class="footer">
                        <a href="<%=request.getContextPath()%>/admin/personal/message/showAllMessages"  class="menuItem" style="font-size: smaller">
                            所有系统消息 <i class="fa fa-arrow-circle-right"></i>
                        </a>
                    </li>
                </ul>
            </li>
            <!-- END INBOX DROPDOWN -->
            <!-- BEGIN TODO DROPDOWN -->
            <li class="dropdown" id="header-tasks" title="未完成工作任务">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                    <i class="fa fa-tasks"></i>
                        <span></span>
                </a>
                <ul class="dropdown-menu tasks list-group">
                    <li class="dropdown-title">
                        <span><i class="fa fa-check"></i>未完成工作任务</span>
                    </li>
                    <li class="footer">
                        <a href="<%=request.getContextPath()%>/admin/dashboard/tasks" style="font-size: smaller" class="menuItem">查看所有工作任务<i class="fa fa-arrow-circle-right"></i></a>
                    </li>
                </ul>
            </li>
            <!-- END TODO DROPDOWN -->
            <!-- BEGIN USER LOGIN DROPDOWN -->
            <li class="dropdown user" id="header-user">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                    <%--<img alt="" src="${user.icon}"/>--%>
                    <%--${ctx}/resources/img/avatars/avatar3.jpg--%>
                    <span class="username">${user.fullName}</span>
                    <i class="fa fa-angle-down"></i>
                </a>
                <ul class="dropdown-menu">
                    <li>
                        <a class="menuItem" data-id="account" href="<%=request.getContextPath()%>/admin/sys/user/updatePassword"><i class="fa fa-cog"></i>
                            账号设置</a>
                    </li>
                    <li>
                        <a class="menuItem" data-id="account" href="<%=request.getContextPath()%>/admin/sys/user/${user.id}/userById"><i class="fa fa-eye"></i> 个人信息</a>
                    </li>
                    <li>
                        <a href="<%=request.getContextPath()%>/admin/logout"><i class="fa fa-power-off"></i> 退出</a>
                    </li>
                </ul>
            </li>
            <!-- END USER LOGIN DROPDOWN -->
        </ul>
        <!-- NAVBAR LEFT -->
        <ul class="nav navbar-nav pull-right" id="navbar-right">
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                    <i class="fa fa-cog"></i>
                    <span class="name">主题</span>
                    <i class="fa fa-angle-down"></i>
                </a>
                <ul class="dropdown-menu skins">
                    <li class="dropdown-title">
                        <span><i class="fa fa-leaf"></i> </span>
                    </li>
                    <li>
                        <a href="#" data-skin="default">默认</a>
                    </li>
                    <li>
                        <a href="#" data-skin="night">夜间</a>
                    </li>
                    <li>
                        <a href="#" data-skin="earth">地球</a>
                    </li>

                    <li>
                        <a href="#" data-skin="nature">自然</a>
                    </li>
                    <li>
                        <a href="#" data-skin="graphite">墨黑</a>
                    </li>
                </ul>
            </li>
        </ul>
        <!-- /NAVBAR LEFT -->
        <!-- END TOP NAVIGATION MENU -->
    </div>
    <!-- TEAM STATUS -->
    <!-- /TEAM STATUS -->
</header>
<!--/HEADER -->
<!-- PAGE -->
<section id="page">
    <!-- SIDEBAR -->
    <div id="sidebar" class="sidebar" style="width: 180px">
        <div class="sidebar-menu nav-collapse">
            <%@include file="menu2.jsp" %>
        </div>
    </div>
    <!-- /SIDEBAR -->
    <div id="main-content" style="margin-left: 180px;">

        <div class="container">
            <div class="row" style="margin-left:-15px;margin-right: -15px; ">
                <div id="content" class="col-lg-12">

                    <div id="content-wrapper" class="content-wrapper">
                        <div class="content-tabs">
                            <button class="roll-nav roll-left tabLeft">
                                <i class="fa fa-backward"></i>
                            </button>
                            <nav class="page-tabs menuTabs">
                                <div class="page-tabs-content" style="margin-left: 0px;">
                                    <shiro:hasPermission name="operatingPlatform:view">
                                        <a href="javascript:;" class="menuTab active" data-id="dashboard">工作台</a>
                                    </shiro:hasPermission>


                                </div>
                            </nav>
                            <button class="roll-nav roll-right tabRight">
                                <i class="fa fa-forward" style="margin-left: 3px;"></i>
                            </button>
                            <div class="btn-group roll-nav roll-right">
                                <button class="dropdown tabClose" data-toggle="dropdown">
                                    页签操作<i class="fa fa-caret-down" style="padding-left: 3px;"></i>
                                </button>
                                <ul class="dropdown-menu dropdown-menu-right">
                                    <li>
                                        <a class="tabReload" href="javascript:void(0);">刷新当前</a>
                                    </li>
                                    <li>
                                        <a class="tabCloseCurrent" href="javascript:void(0);">关闭当前</a>
                                    </li>
                                    <li>
                                        <a class="tabCloseAll" href="javascript:void(0);">全部关闭</a>
                                    </li>
                                    <li>
                                        <a class="tabCloseOther" href="javascript:void(0);">除此之外全部关闭</a>
                                    </li>
                                </ul>
                            </div>
                            <button class="roll-nav roll-right fullscreen"><i class="fa fa-arrows-alt"></i></button>
                        </div>

                        <div class="content-iframe" style="/*overflow:hidden*/ ">
                            <div class="mainContent" id="content-main" style="  margin-top: 10px;  padding: 0;">
                                <shiro:hasPermission name="operatingPlatform:view">
                                    <iframe class="LRADMS_iframe" width="100%" name="iframedashboard" src="<%=request.getContextPath()%>/admin/saleOrderHeader/list"
                                            frameborder="0" data-id="dashboard"></iframe>
                                </shiro:hasPermission>

                            </div>
                        </div>
                    </div>
                    <!-- /CONTENT-->
                </div>
            </div>
        </div>
    </div>
</section>
<script>
    $(function () {
        refreshSystemMessage();//显示系统消息数量
        App.setPage("main"); //Set current page
        App.init(); //Initialise plugins and elements
        $("iframe[name='iframedashboard']").load(function () {
            var mainHeight = $(this).contents().find("html").height();
            console.log(mainHeight)
            $(this).height(680);
        });
        $("iframe[name='iframedefault']").load(function () {
            var mainHeight = $(this).contents().find(".tab-body").height();
            $(this).height(mainHeight+20);
        });
        //刷新系统消息，每隔3秒钟执行一次 refreshSystemMessage）
        //window.setInterval(refreshSystemMessage, 10000);
    });

    //异步刷新系统消息
    function refreshSystemMessage() {
        //ajax异步刷新数据
        $.ajax({
            type: "post",
            dataType: "json",
            url: '<%=request.getContextPath()%>/admin/showMessages',
            //data: dataurl,
            success: function (data) {
                //console.log(data);
                if(data[0]!=0){
                    $("#header-notification").find("a:not(.menuItem) span").replaceWith("<span class='badge'>"+data[0]+"</span>");       //待办事项
                }else {
                    $("#header-notification").find("a:not(.menuItem) span").replaceWith("<span></span>");
                }
                if(data[1]!=0){
                    $("#header-message").find("a:not(.menuItem) span").replaceWith("<span class='badge'>"+data[1]+"</span>");            //未读系统消息
                }else {
                    $("#header-message").find("a:not(.menuItem) span").replaceWith("<span></span>");
                }
                if(data[2]!=0){
                    $("#header-tasks").find("a:not(.menuItem) span").replaceWith("<span class='badge'>"+data[2]+"</span>");              //未完成工作任务
                }else {
                    $("#header-tasks").find("a:not(.menuItem) span").replaceWith("<span></span>");
                }
            }
        });
    }
</script>
</body>
</html>